package com.ruleengine.db.model;

import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author lianghanwei on 2024/3/16
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("rule_chain")
public class Rulechain {

    @TableId(type = IdType.AUTO)
    private Long id;

    private String tenantId;
    private String ruleengineId;
    private String rulechainId;
    private String name;
    private String description;
    private String topic;

    @Version
    private Integer resourceVersion;

    /**
     * MP 的 @TableLogic 不适用有两个正常状态，比如这里 0、1 都是未删除状态
     * 其通过 == value/delval 判断的
     */
    private RulechainState state;

    private RulechainStatus status;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

}
